package com.craterhill.java.ccp.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.craterhill.java.ccp.common.beans.Parent;
import com.craterhill.java.ccp.dao.impl.AbstractDao;
import com.craterhill.java.ccp.dao.utils.CCPResultSetExtractor;

public interface ParentsDao extends CCPDao<Parent> {

	public final String FIELD_LIST = "obj.parents_id, obj.student_id, obj.father_first_name, obj.father_middle_name, obj.father_last_name, obj.father_mobile_number, obj.mother_first_name, obj.mother_middle_name, obj.mother_last_name, obj.mother_mobile_number, obj.street, obj.area, obj.city, obj.state, obj.country_id, obj.zip_code, obj.email_id, obj.more_info"
			+ AbstractDao.MONITER_FIELDS;

	public final String FIND_ALL_PARENTS = " select " + FIELD_LIST + " from parents obj ";

	public final class ParentsExtractor extends CCPResultSetExtractor<Parent> {

		@Override
		protected Parent extractResultSetData(ResultSet resultSet) throws SQLException {
			Parent parents = new Parent();
			parents.setParentsId(resultSet.getInt(1));
			parents.setStudentId(resultSet.getInt(2));
			parents.setFatherFirstName(resultSet.getString(3));
			parents.setFatherMiddleName(resultSet.getString(4));
			parents.setFatherLastName(resultSet.getString(5));
			parents.setFatherMobileNumber(resultSet.getString(6));
			parents.setMotherFirstName(resultSet.getString(7));
			parents.setMotherMiddleName(resultSet.getString(8));
			parents.setMotherLastName(resultSet.getString(9));
			parents.setMotherMobileNumber(resultSet.getString(10));
			parents.setStreet(resultSet.getString(11));
			parents.setArea(resultSet.getString(12));
			parents.setCity(resultSet.getString(13));
			parents.setState(resultSet.getString(14));
			parents.setCountryId(resultSet.getInt(15));
			parents.setZipCode(resultSet.getInt(16));
			parents.setEmailId(resultSet.getString(17));
			parents.setMoreInfo(resultSet.getString(18));
			parents.setStatus(resultSet.getBoolean(19));
			parents.setCreatedBy(resultSet.getInt(20));
			parents.setModifiedBy(resultSet.getInt(21));
			parents.setCreatedDate(resultSet.getDate(22));
			parents.setModifiedDate(resultSet.getDate(23));
			return parents;

		}
	}

}
